package com.honour.service.interfaced.impl;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

import com.honour.service.interfaced.DiscoverInManager;
import com.system.dao.DaoSupport;
import com.system.util.PageData;

/** 
 * 说明： 发现视频表
 * 创建人：zhaozhenhua
 * 创建时间：2017-12-05
 * @version
 */
@Service("discoverinService")
public class DiscoverInService implements DiscoverInManager{

	@Resource(name = "daoSupport")
	private DaoSupport dao;

	/**
	 * 获取所有的菜单项
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<PageData> getCaiDanList(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("DiscoverInMapper.getCaiDanList", pd);
	}

	/**
	 * 根据菜单ID获取视频
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<PageData> getVideoListById(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("DiscoverInMapper.getVideoListById", pd);
	}

	/**
	 * 商家发布自媒体广告流
	 * @return 
	 */
	@Override
	public void addSelfMediaAd(PageData pd) throws Exception {
	    dao.save("DiscoverInMapper.addSelfMediaAd", pd);
	}

	/**
	 * 根据用户id获取头条订阅
	 */
	@Override
	public PageData getTopLineById(PageData pd) throws Exception {
		return (PageData)dao.findForObject("UserTopLineInMapper.getTopLineById", pd);
	}

	/**
	 * 根据名称查询菜单
	 */
	@Override
	public PageData getCaiDanById(String id) throws Exception {
		return (PageData)dao.findForObject("DiscoverInMapper.getCaiDanById", id);
	}

	/**
	 * 修改用户订阅的头条
	 */
	@Override
	public void updTopLine(PageData pd) throws Exception {
		dao.update("UserTopLineInMapper.updTopLine", pd);
	}

	/**
	 * 用户注册成功后初始化头条我的菜单
	 */
	@Override
	public void addUserTopLine(PageData pd) throws Exception {
		dao.save("UserTopLineInMapper.addUserTopLine", pd);
	}

	/**
	 * 修改头条的浏览量
	 */
	@Override
	public void updPageViews(PageData pd) throws Exception {
		dao.update("DiscoverInMapper.updPageViews", pd);
	}

	/**
	 * 根据id获取头条详情
	 */
	@Override
	public PageData getHeadTopById(PageData pd) throws Exception {
		return (PageData)dao.findForObject("DiscoverInMapper.getHeadTopById", pd);
	}
	
	
}

